<div class="jumbotron">
	<div class="container text-center">
		<img class="logo" src="/assets/images/logo.svg">
		<h1 class="brand display-3">Goproxy China</h1>
		<p>The most trusted Go module proxy in China.</p>
		<p><span class="badge badge-success">{{.ModuleVersionCount}} module versions cached</span></p>
		<a class="github-button" href="https://github.com/goproxy/goproxy.cn" data-size="large" data-show-count="true" aria-label="Star goproxy/goproxy.cn on GitHub">Star</a>
	</div>
</div>

<div class="container">
	<div class="row text-center">
		<div class="col-md-3">
			<h3 class="text-info"><i class="fas fa-rocket"></i>&nbsp;Blazing Fast</h3>
			<p>We are using <a href="https://www.qiniu.com/en/products/qcdn" target="_blank">Qiniu Cloud CDN</a> to accelerate our service globally without placing any bandwidth limits. With thousands of CDN nodes and <b>40Gbps+ single-node bandwidth</b>, you will be given the ability to download module versions at a blazing fast speed.</p>
		</div>

		<div class="col-md-3">
			<h3 class="text-info"><i class="fas fa-infinity"></i>&nbsp;No Limit</h3>
			<p>We do not just place no bandwidth limits. Furthermore, we <b>have not placed any rate limits</b>. This means that you can use our service in any scenario, like CI/CD. You can even use our service as an upstream proxy, just like <a href="https://goproxy.baidu.com" target="_blank">goproxy.baidu.com</a> does.</p>
		</div>

		<div class="col-md-3">
			<h3 class="text-info"><i class="fas fa-th-large"></i>&nbsp;Full Featured</h3>
			<p>We are always using the latest Go version, even the unstable version. Because we provide <b>cutting-edge feature support</b>. In particular, we support <a href="https://golang.org/design/25530-sumdb#proxying-a-checksum-database" target="_blank">proxying</a> the default checksum database <a href="https://sum.golang.org" target="_blank">sum.golang.org</a>. You don't need to do anything extra, it just works.</p>
		</div>

		<div class="col-md-3">
			<h3 class="text-info"><i class="fas fa-eye"></i>&nbsp;Data Visualized</h3>
			<p>For everyone to better understand the activity of all modules in our service, we have launched the very first <a href="/stats">Statistics API</a> of the Go module proxy world. With the decent RESTful API design, you will be able to easily query statistics for all module versions in our service.</p>
		</div>
	</div>

	<hr>

	<div class="row text-center">
		<div class="col-md">
			<h3 id="Usage"><a class="font-weight-bold text-info" href="#Usage">Usage</a></h3>
		</div>
	</div>

	<div class="row">
		<div class="col-md">
			<p id="Go 1.13 and above (RECOMMENDED)"><a class="font-weight-bold text-info" href="#Go 1.13 and above (RECOMMENDED)">Go 1.13 and above (RECOMMENDED)</a></p>
			<p>Open your terminal and execute</p>
			<pre><code class="language-bash">$ go env -w GO111MODULE=on
$ go env -w GOPROXY=https://goproxy.cn,direct</code></pre>
			<p>done.</p>

			<p id="macOS or Linux"><a class="font-weight-bold text-info" href="#macOS or Linux">macOS or Linux</a></p>
			<p>Open your terminal and execute</p>
			<pre><code class="language-bash">$ export GO111MODULE=on
$ export GOPROXY=https://goproxy.cn</code></pre>
			<p>or</p>
			<pre><code class="language-bash">$ echo "export GO111MODULE=on" >> ~/.profile
$ echo "export GOPROXY=https://goproxy.cn" >> ~/.profile
$ source ~/.profile</code></pre>
			<p>done.</p>

			<p id="Windows"><a class="font-weight-bold text-info" href="#Windows">Windows</a></p>
			<p>Open your terminal and execute</p>
			<pre><code class="language-bash">C:\> $env:GO111MODULE = "on"
C:\> $env:GOPROXY = "https://goproxy.cn"</code></pre>
			<p>or</p>
			<pre><code class="language-md">1. Open the Start Search, type in "env"
2. Choose the "Edit the system environment variables"
3. Click the "Environment Variables…" button
4. Under the "User variables for &lt;YOUR_USERNAME&gt;" section (the upper half)
5. Click the "New..." button
6. Choose the "Variable name" input bar, type in "GO111MODULE"
7. Choose the "Variable value" input bar, type in "on"
8. Click the "OK" button
9. Click the "New..." button
10. Choose the "Variable name" input bar, type in "GOPROXY"
11. Choose the "Variable value" input bar, type in "https://goproxy.cn"
12. Click the "OK" button</code></pre>
			<p>done.</p>
		</div>
	</div>

	<hr>

	<div class="row text-center">
		<div class="col-md">
			<h3 id="Self-hosted Go module proxy"><a class="font-weight-bold text-info" href="#Self-hosted Go module proxy">Self-hosted Go module proxy</a></h3>
		</div>
	</div>

	<div class="row">
		<div class="col-md">
			<p>Your code is always yours, so we provide you with the coolest self-hosted Go module proxy building solution in the world. By using <a href="https://github.com/goproxy/goproxy" target="_blank">Goproxy</a>, a minimalist project, you can easily add Go module proxy support to any existing web service, you know that <a href="https://goproxy.cn" target="_blank">goproxy.cn</a> is built on it.</p>
			<p>Create a file named <code>goproxy.go</code></p>
			<pre><code class="language-go">package main

import (
	"net/http"
	"os"

	"github.com/goproxy/goproxy"
)

func main() {
	g := goproxy.New()
	g.GoBinEnv = append(
		os.Environ(),
		"GOPROXY=https://goproxy.cn,direct", // Use goproxy.cn as the upstream proxy
		"GOPRIVATE=git.example.com",         // Solve the problem of pulling private modules
	)
	http.ListenAndServe("localhost:8080", g)
}</code></pre>
			<p>and run it</p>
			<pre><code class="language-bash">$ go run goproxy.go</code></pre>
			<p>then try it by setting <code>GOPROXY</code> to <code>http://localhost:8080</code>. In addition, we also recommend that you set <code>GO111MODULE</code> to <code>on</code>.</p>
			<p>That's it, a fully functional Go module proxy is successfully built. In fact, you can use <a href="https://github.com/goproxy/goproxy" target="_blank">Goproxy</a> with your favorite web frameworks, such as <a href="https://pkg.go.dev/github.com/gin-gonic/gin#WrapH" target="_blank">Gin</a> and <a href="https://pkg.go.dev/github.com/labstack/echo/v4#WrapHandler" target="_blank">Echo</a>, all you need to do is add one more route. For more advanced usage please check the <a href="https://pkg.go.dev/github.com/goproxy/goproxy" target="_blank">documentation</a>.</p>
		</div>
	</div>
</div>
